# {} 、 dict 、get 、del 、pop、del、update、keys、values、items


if __name__ == '__main__':

    # 字典的两种初始化 {} 、 dict
    var2 = {}
    print(type(var2))

    var2 = dict()
    print(type(var2))

    var2 = {'age': 23, 'name': 'zhangsan', 'addr': 'xian'}
    print(var2)

    # 字典的遍历
    for item in var2.items():
        print(item)

    for (k, v) in var2.items():
        print(k, v)

    for k, v in var2.items():
        print(k, v)

    for k in var2.keys():
        print(k, var2[k])

    for k in var2.keys():
        print(k, var2.get(k))

    print(var2.values())

    # 增删改查
    del var2['name']
    print(var2)
    print(var2.pop('age'))
    print(var2)

    # update 将参数合并到字典中
    var3 = {'xingbie': '男'}
    var2.update(var3)
    print(var3)

